using System;
using Sedge.Core.Configuration;
using Sedge.Core.Execution;
using Sedge.Core.Globalization;
using Sedge.UI.View;
using Sedge.UI.ViewModel;

namespace Sedge.UI.Controller
{
	public class CollectController : IStepController
	{
		#region Private fields

		private Suite _suite;
		private Options _options;
		private CollectView _view;
		private CollectViewModel _viewModel;

		#endregion //Private fields

		public object View
		{
			get
			{
				if (_view == null)
				{
					_viewModel = new CollectViewModel(_suite, _options);
					_view = new CollectView(_viewModel);
				}

				return _view;
			}
		}

		public string Caption
		{
			get
			{
				string caption = _options.Caption();
				if (String.IsNullOrEmpty(caption))
					caption = Locale.Strings.CollectCaption;

				return caption;
			}
		}

		public void Initialize(Suite suite, Options options)
		{
			_suite = suite;
			_options = options;
		}

		public bool EnterStep(bool fromPrev)
		{
			_viewModel.Start();
			return false;
		}

		public bool LeaveStep(bool toNext)
		{
			return false;
		}
	}
}